package com.idanchuang.component.businesslog.es.util;

import java.util.ArrayList;
import java.util.List;

/**
 * desc
 *
 * @author yjy
 * 2020-02-11 15:33
 */
public class PageResponse<T> {

    private int pageNo;
    private int size;
    private int allCount;
    private List<T> list;

    public PageResponse() {
    }

    public PageResponse(int allCount, int pageNo, int size) {
        this.list = new ArrayList<>();
        this.allCount = allCount;
        this.pageNo = pageNo;
        this.size = size;
    }

    public PageResponse(List<T> list, int allCount, int pageNo, int size) {
        this.list = list;
        this.allCount = allCount;
        this.pageNo = pageNo;
        this.size = size;
    }

    public boolean hasValue() {
        return list != null && !list.isEmpty();
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public int getAllCount() {
        return allCount;
    }

    public void setAllCount(int allCount) {
        this.allCount = allCount;
    }

    @Override
    public String toString() {
        return "PageResponse{" +
                "pageNo=" + pageNo +
                ", size=" + size +
                ", allCount=" + allCount +
                ", list=" + list +
                '}';
    }
}
